package com.tengju.user.infrastructure.repository.sign;

import com.tengju.user.domain.model.archive.letax.LetaxAccount;
import com.tengju.user.domain.model.archive.letax.LetaxStatus;
import com.tengju.user.domain.model.archive.sign.LetaxRegisteredRepository;
import com.tengju.user.domain.model.user.UserIdCode;
import com.tengju.user.infrastructure.persistence.mybatis.dataobject.LetaxAccountDO;
import com.tengju.user.infrastructure.persistence.mybatis.mapper.dealer.generate.LetaxAccountDOMapper;
import com.tengju.user.infrastructure.repository.convert.LetaxAccountConvert;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;

@Repository
public class LetaxRegisteredRepositoryImpl implements LetaxRegisteredRepository {

    @Resource
    LetaxAccountDOMapper letaxAccountMapper;

    @Override
    public LetaxAccount getLetaxAccount(UserIdCode idCode, LetaxStatus status) {
        LetaxAccountDO letaxAccountDO =
                letaxAccountMapper.findOneByIdCodeStatus(idCode.getValue(), status.getVal());
        return LetaxAccountConvert.convert(letaxAccountDO);
    }
}
